import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'h-date'
})
export class DatePipe implements PipeTransform {

  transform(value: any, args?: any): any {
    if(!value) return value;
    if(typeof value !==  'number'){
      throw new Error('Invalid pipe argument for DatePip')
    }
    return new Date(value);
  }

}
